#define _CRT_SECURE_NO_WARNINGS 1

#include < stdio.h>

int count = 0;
void fufu1(int* arr, int sz)
{
	int flag = 1;
	int i = 0;
	for (i = 0; i < sz - 1; i++)
	{
		int j = 0;
		for (j = 0; j < sz - 1 - i; j++)
		{
			if (arr[j] > arr[j + 1])
			{
				int tmp = arr[j];
				arr[j] = arr[j + 1];
				arr[j + 1] = tmp;
				flag = 0;
				count++;
			}
		}
		if (flag == 1)
		{
			break;
		}
	}
}
void fufu2(int* arr, int sz)
{
	int i = 0;
	for (i = 0; i < sz; i++)
	{
		printf("%d ", arr[i]);
	}
}
int main()
{
	int arr[] = { 9,0,1,2,3,4,5,6,7,8 };
	int sz = sizeof(arr) / sizeof(arr[0]);
	fufu1(arr, sz);
	fufu2(arr, sz);

	printf("\ncount = %d\n", count);

	return 0;
}

